// A5. Complier Characteristics
// A5. Complier Characteristics
// A5. Complier Characteristics



// PRELIMINARIES

clear
set more off
set scheme s1mono



// LOAD DATA
	
use "JakielaOzierFernaldKnauer-preschool-data.dta", replace



local controls "i.childage haz male cgmom momeduc momluo hhsize sibs numassets haz_imputed dadabsent dadeduc dadluo missing_data i.schoolid"



// IDENTIFY COVARIATES TO LOOK AT

local trait1 "male"

sum haz if roundage==3, d
gen lowhaz = haz<=r(p50) if roundage==3

gen lowassets = numassets<=3 if roundage==3

gen lowedu = momedu<=7 if roundage==3

local trait1 "male"
local trait2 "lowhaz"
local trait3 "lowassets"
local trait4 "lowedu"

forvalues i = 1/4 {
	
gen traitxdistance = `trait`i''*schdist

reg inschool schdist `trait`i'' traitxdistance `controls' if roundage==3, cluster(respid)

mat V = r(table)
	local _beta_1_`i' = string(V[1,1],"%04.3f")
	local _se_1_`i' = string(V[2,1],"%04.3f")
	local _pval_1_`i' = string(V[4,1],"%04.3f")
	local _beta_2_`i' = string(V[1,2],"%04.3f")
	local _se_2_`i' = string(V[2,2],"%04.3f")
	local _pval_2_`i' = string(V[4,2],"%04.3f")
	local _beta_3_`i' = string(V[1,3],"%04.3f")
	local _se_3_`i' = string(V[2,3],"%04.3f")
	local _pval_3_`i' = string(V[4,3],"%04.3f")
	local _obs`i' = e(N)
	
drop traitxdistance
}
	
cap file close fh
file open fh using "out/A5-compliers.tex", write replace

file write fh "Distance to school (km)	& `_beta_1_1' & `_beta_1_2' & `_beta_1_3' & `_beta_1_4'  \\ " _newline
file write fh "		    			& (`_se_1_1') & (`_se_1_2') & (`_se_1_3') & (`_se_1_4') \\ " _newline
file write fh "		    			& [`_pval_1_1'] & [`_pval_1_2'] & [`_pval_1_3'] & [`_pval_1_4'] \\ " _newline

file write fh "Characteristic		& `_beta_2_1' & `_beta_2_2' & `_beta_2_3' & `_beta_2_4' \\ " _newline
file write fh "		    			& (`_se_2_1') & (`_se_2_2') & (`_se_2_3') & (`_se_2_4') \\ " _newline
file write fh "		    			& [`_pval_2_1'] & [`_pval_2_2'] & [`_pval_2_3'] & [`_pval_2_4']  \\ " _newline

file write fh "Characteristic $\times$ distance		& `_beta_3_1' & `_beta_3_2' & `_beta_3_3' & `_beta_3_4' \\ " _newline
file write fh "		    			& (`_se_3_1') & (`_se_3_2') & (`_se_3_3') & (`_se_3_4') \\ " _newline
file write fh "		    			& [`_pval_3_1'] & [`_pval_3_2'] & [`_pval_3_3'] & [`_pval_3_4']   \\ " _newline

file close fh

